<?php
namespace Store\Model;
use Think\Model\RelationModel;

class ScenicEntertainmentModel extends RelationModel{
	protected $_link = array(
		'Scenic' =>array(
			'mapping_type'  => self::BELONGS_TO,
			'foreign_key'   => 'scenic_id',
			'mapping_fields'=> 'name',
			'as_fields'     => 'name:scenic',
		),
	);
	protected $_auto = array (
		array('id','getId',self::MODEL_INSERT,'callback') , // 对id字段在新增的时候自动生成一个ID
		array('time','time',self::MODEL_INSERT,'function') , // 对createTime字段在新增时添加当前的时间
	);
	function getId(){
		$util = A('Util');
		return  'T'.$util->getId();//生成用户ID
	}
}
?>